package vwg.na.vwm.rh.motorsdk.modelo.procesos.daoimpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import vwg.na.vwm.rh.motorsdk.modelo.procesos.dao.IdeAsignacionBODAO;
import vwg.na.vwm.rh.motorsdk.modelo.procesos.entidadesgrales.IdeAsignacionBO;
import vwg.na.vwm.rh.rhmotor.modelo.dao.GenericDAO;

@Repository
public class IdeAsignacionBODAOImpl extends GenericDAO<IdeAsignacionBODAO>
	implements IdeAsignacionBODAO {
    
    @SuppressWarnings("unchecked")
    @Override
    @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
    public List<IdeAsignacionBO> getAll() {
	return getHibernateTemplate().find("FROM IdeAsignacionBO as i");
    }

    @Override
    @Transactional(readOnly = true, propagation = Propagation.REQUIRED)
    public IdeAsignacionBO getByName(String name) {
	return (IdeAsignacionBO) getHibernateTemplate().find("FROM IdeAsignacionBO as i "
		+ "WHERE i.nombre = ?", name).get(0);
    }

}
